package y_2025.m07.d23;

/**
 * 查看类加载器的层级关系
 */
public class ClassLoaderDemo2 {

    public static void main(String[] args) {

        //获取系统类加载器（应用程序类加载器）
        ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
        System.out.println(systemClassLoader);//AppClassLoader@

        //获取其上层：扩展类加载器
        ClassLoader extClassLoader = systemClassLoader.getParent();
        System.out.println(extClassLoader);//ExtClassLoader

        //获取其上层：获取引导类加载器（启动类加载器）
        ClassLoader bootstrapClassLoader = extClassLoader.getParent();
        System.out.println(bootstrapClassLoader);//null：底层C/C++实现
    }
}